import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { AppLayoutComponent } from 'src/layout/app.layout.component';
import { NotfoundComponent } from './notfound/notfound.component';

const routes: Routes = [
  {
    path: '', component: AppLayoutComponent,
    children: [
      {
        path: '',
        loadChildren: () => import('src/components/dashboard/dashboard.module').then(m => m.DashboardModule)
      },
      {
        path: 'pages', 
        loadChildren: () => import('src/components/pages/pages.module').then(m => m.PagesModule)
      },
      {
        path: 'scenarios', 
        loadChildren: () => import('src/components/scenarios/scenarios.module').then(m => m.ScenariosModule)
      },
    ]
  },
  {
    path: 'auth',
    loadChildren: () => import('src/components/auth/auth.module').then(m => m.AuthModule)
  },
  { path: 'notfound', component: NotfoundComponent },
  { path: '**', redirectTo: '/notfound' },
];

@NgModule({
  imports: [RouterModule.forRoot(routes, { scrollPositionRestoration: 'enabled', anchorScrolling: 'enabled', onSameUrlNavigation: 'reload' })],
  exports: [RouterModule]
})
export class AppRoutingModule { }
